#define _CRT_SECURE_NO_WARNINGS

#include "SingleList.h"

void testCout()
{
	std::cout << "hello World!!" << std::endl;
}

void testSingleList()
{
	SL* s=nullptr;
	printf("EMpty:%s\n", s->isEmpty() ? "Yes" : "No");
	s->PushBack(s, 90);
	s->PushFront(s, 1);
	s->PushFront(s, 2);
	s->PushFront(s, 3);
	s->PushFront(s, 4);
	s->PushFront(s, 5);
	s->PushBack(s, -60);
	s->Print();
	printf("EMpty:%s\n", s->isEmpty() ? "Yes" : "No");

	while (!s->isEmpty())
	{
		//s->PopFront(s);
		printf("head:%d\ttail:%d\n", s->Head(), s->Tail());
		s->PopBack(s);
		s->Print();
		printf("EMpty:%s\n", s->isEmpty() ? "Yes" : "No");
		std::cout << s->Size() << std::endl;

		std::cout << "----------------" << std::endl;
	}
	
	s->PushBack(s, -60);
	s->PushFront(s, 14);
	s->PushBack(s, 5);
	s->Print();
	SL* find=s->Find(15);
	printf("find15:%s\n", find == nullptr ? "notFind" : "find");
	find = s->Find(-60);
	printf("find-60:%s\n", find == nullptr ? "notFind" : "find");
	s->Erase(s, find);
	s->Print();
	s->Erase(s, s->Find(11));
	s->Print();
	s->Erase(s, s->Find(14));
	s->Print();
	s->Erase(s, s->Find(5));
	s->Print();

	s->Destroy();
	s = nullptr;
}
int main()
{
	//testCout();
	testSingleList();
	return 0;
}